home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 October / CHIP Turkiye Ekim 2000.iso / prog / naps / 04 / setup.exe / Gnucleus / HyperLink.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-17  |  3.6 KB  |  107 lines

  1. // HyperLink.h : header file
  2. //
  3. //
  4. // HyperLink static control. Will open the default browser with the given URL
  5. // when the user clicks on the link.
  6. //
  7. // Copyright Chris Maunder, 1997-1999 (cmaunder@mail.com)
  8. // Feel free to use and distribute. May not be sold for profit. 
  9.  
  10. // 2/29/00 -- P. Shaffer standard font mod.
  11.  
  12. #if !defined(AFX_HYPERLINK_H__D1625061_574B_11D1_ABBA_00A0243D1382__INCLUDED_)
  13. #define AFX_HYPERLINK_H__D1625061_574B_11D1_ABBA_00A0243D1382__INCLUDED_
  14.  
  15. #if _MSC_VER >= 1000
  16. #pragma once
  17. #endif // _MSC_VER >= 1000
  18.  
  19. /////////////////////////////////////////////////////////////////////////////
  20. // CHyperLink window
  21.  
  22. class CHyperLink : public CStatic
  23. {
  24. // Construction/destruction
  25. public:
  26.     CHyperLink();
  27.     virtual ~CHyperLink();
  28.  
  29. public:
  30.     enum UnderLineOptions { ulHover = -1, ulNone = 0, ulAlways = 1};
  31.  
  32. // Attributes
  33. public:
  34.     void SetURL(CString strURL);
  35.     CString GetURL() const;
  36.  
  37.     void SetColours(COLORREF crLinkColour, COLORREF crVisitedColour, 
  38.                     COLORREF crHoverColour = -1);
  39.     COLORREF GetLinkColour() const;
  40.     COLORREF GetVisitedColour() const;
  41.     COLORREF GetHoverColour() const;
  42.  
  43.     void SetVisited(BOOL bVisited = TRUE);
  44.     BOOL GetVisited() const;
  45.  
  46.     void SetLinkCursor(HCURSOR hCursor);
  47.     HCURSOR GetLinkCursor() const;
  48.  
  49.     void SetUnderline(int nUnderline = ulHover);
  50.     int  GetUnderline() const;
  51.  
  52.     void SetAutoSize(BOOL bAutoSize = TRUE);
  53.     BOOL GetAutoSize() const;
  54.  
  55. // Overrides
  56.     // ClassWizard generated virtual function overrides
  57.     //{{AFX_VIRTUAL(CHyperLink)
  58.     public:
  59.     virtual BOOL PreTranslateMessage(MSG* pMsg);
  60.     virtual BOOL DestroyWindow();
  61.     protected:
  62.     virtual void PreSubclassWindow();
  63.     //}}AFX_VIRTUAL
  64.  
  65. // Implementation
  66. protected:
  67.     HINSTANCE GotoURL(LPCTSTR url, int showcmd);
  68.     void ReportError(int nError);
  69.     LONG GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata);
  70.     void PositionWindow();
  71.     void SetDefaultCursor();
  72.  
  73. // Protected attributes
  74. protected:
  75.     COLORREF m_crLinkColour, m_crVisitedColour;     // Hyperlink colours
  76.     COLORREF m_crHoverColour;                       // Hover colour
  77.     BOOL     m_bOverControl;                        // cursor over control?
  78.     BOOL     m_bVisited;                            // Has it been visited?
  79.     int      m_nUnderline;                          // underline hyperlink?
  80.     BOOL     m_bAdjustToFit;                        // Adjust window size to fit text?
  81.     CString  m_strURL;                              // hyperlink URL
  82.     CFont    m_UnderlineFont;                       // Font for underline display
  83.     CFont    m_StdFont;                             // Standard font
  84.     HCURSOR  m_hLinkCursor;                         // Cursor for hyperlink
  85.     CToolTipCtrl m_ToolTip;                         // The tooltip
  86.     UINT     m_nTimerID;
  87.  
  88.     // Generated message map functions
  89. protected:
  90.     //{{AFX_MSG(CHyperLink)
  91.     afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor);
  92.     afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
  93.     afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  94.     afx_msg void OnTimer(UINT nIDEvent);
  95.     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  96.     //}}AFX_MSG
  97.     afx_msg void OnClicked();
  98.     DECLARE_MESSAGE_MAP()
  99. };
  100.  
  101. /////////////////////////////////////////////////////////////////////////////
  102.  
  103. //{{AFX_INSERT_LOCATION}}
  104. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  105.  
  106. #endif // !defined(AFX_HYPERLINK_H__D1625061_574B_11D1_ABBA_00A0243D1382__INCLUDED_)
  107.